feat: count XBlocks with optional_completion#279
Open
Agrendalath wants to merge 5 commits intomasterfrom
Open
Conversation
11 tasks
eef91da to
53473df
Compare
80c26d7 to
e1a6a84
Compare
optional_completionoptional_completion
There was a problem hiding this comment.
Pull request overview
This PR adds support for tracking optional completion of XBlocks in the completion-aggregator service. The feature enables separate tracking and reporting of optional vs. required blocks in Open edX courses, with optional blocks identified by the optional_completion XBlock field.
Changes:
- Added three new fields to the Aggregator model:
optional_earned,optional_possible, andoptional_percentwith corresponding database migration - Extended the aggregation logic to separately track completion of optional blocks
- Added
include_optionalAPI parameter to optionally expose optional completion data in API responses - Updated serializers to conditionally include optional completion data
- Added comprehensive test coverage for the new functionality
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| completion_aggregator/models.py | Added three new fields for tracking optional completions and updated SQL query to include them |
| completion_aggregator/migrations/0007_aggregator_optional_completion.py | Migration to add optional completion fields to Aggregator model |
| completion_aggregator/core.py | Updated aggregation logic to separately track optional blocks and calculate their completion stats |
| completion_aggregator/compat.py | Added is_block_optional() function to check if a block is optional |
| completion_aggregator/transformers.py | Updated to request optional_completion XBlock field |
| completion_aggregator/serializers.py | Added optional completion serializer and updated existing serializers to conditionally include optional data |
| completion_aggregator/api/common.py | Added get_include_optional() method to parse the include_optional parameter |
| completion_aggregator/api/v0/views.py | Updated views to pass include_optional parameter and documented the new parameter |
| completion_aggregator/api/v1/views.py | Updated views to pass include_optional parameter and documented the new parameter |
| test_utils/compat.py | Added test implementation of is_block_optional() |
| tests/test_models.py | Added tests for optional completion field defaults, validation, and get_values behavior |
| tests/test_core.py | Added tests for optional block aggregation with full and partial completion |
| tests/test_serializers.py | Added tests for optional completion serialization in various scenarios |
| tests/test_views.py | Added tests for include_optional parameter in list and detail views |
| completion_aggregator/init.py | Version bumped to 4.4.0rc |
| CHANGELOG.rst | Added changelog entry for version 4.4.0 |
| codecov.yml | Reduced patch coverage target from 100% to 75% |
| .coveragerc | Updated coverage omit patterns |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
completion_aggregator/migrations/0007_aggregator_optional_completion.py
Outdated
Show resolved
Hide resolved
e1a6a84 to
e265b71
Compare
e265b71 to
d0fed71
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description: This adds support for optional completion implemented in open-craft/openedx-platform#823.
Dependencies:
Merge deadline: None
Installation instructions: For now, this requires a Redwood instance, as the optional completion is implemented only in this release. Therefore, it may be easier to test this one on a sandbox instance.
Testing instructions:
ENABLE_COURSE_ACTIVITY_SIGNALS = Trueto your instance configs.Reviewers:
Merge checklist:
Post merge:
finished.
Private-ref: BB-9331